<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

namespace App\Constants;

use Hyperf\Constants\AbstractConstants;
use Hyperf\Constants\Annotation\Constants;

#[Constants]
class ErrorCode extends AbstractConstants
{
    /**
     * @Message("Success")
     */
    public const SUCCESS = 0;

    /**
     * @Message("Bad Request")
     */
    public const BAD_REQUEST = 400;

    /**
     * @Message("Unauthorized")
     */
    public const UNAUTHORIZED = 401;

    /**
     * @Message("Forbidden")
     */
    public const FORBIDDEN = 403;

    /**
     * @Message("Not Found")
     */
    public const NOT_FOUND = 404;

    /**
     * @Message("Method Not Allowed")
     */
    public const METHOD_NOT_ALLOWED = 405;

    /**
     * @Message("Request Timeout")
     */
    public const REQUEST_TIMEOUT = 408;

    /**
     * @Message("Validation Failed")
     */
    public const VALIDATION_ERROR = 422;

    /**
     * @Message("Too Many Requests")
     */
    public const TOO_MANY_REQUESTS = 429;

    /**
     * @Message("Internal Server Error")
     */
    public const SERVER_ERROR = 500;

    /**
     * @Message("Service Unavailable")
     */
    public const SERVICE_UNAVAILABLE = 503;

    // 业务错误码（10000+）
    /**
     * @Message("User Not Found")
     */
    public const USER_NOT_FOUND = 10001;

    /**
     * @Message("User Already Exists")
     */
    public const USER_ALREADY_EXISTS = 10002;

    /**
     * @Message("Invalid Credentials")
     */
    public const INVALID_CREDENTIALS = 10003;

    /**
     * @Message("Token Expired")
     */
    public const TOKEN_EXPIRED = 10004;

    /**
     * @Message("Invalid Token")
     */
    public const INVALID_TOKEN = 10005;

    /**
     * @Message("Permission Denied")
     */
    public const PERMISSION_DENIED = 10006;

    /**
     * @Message("Database Error")
     */
    public const DATABASE_ERROR = 10007;

    /**
     * @Message("Resource Not Found")
     */
    public const RESOURCE_NOT_FOUND = 10008;

    /**
     * @Message("Operation Failed")
     */
    public const OPERATION_FAILED = 10009;
}
